﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ServiceNetworkDesign.Utilities
{
    /// <summary>
    /// 节点则抽象成Node类，一个节点上挂着以此节点作为起点的“出边”表。
    /// </summary>
    public class Node
    {
        private string iD;
        private List<Edge> edgeList;//Edge的集合－－出边表

        public Node(string id)
        {
            this.iD = id;
            this.edgeList = new List<Edge>();
        }

        #region property
        public string ID
        {
            get
            {
                return this.iD;
            }
        }

        public List<Edge> EdgeList
        {
            get
            {
                return this.edgeList;
            }
        }
        #endregion
        #region 根据结束节点获取路径
        public Edge GetEdgeByNode(string endNodeId)
        {
            return  this.EdgeList.Find(p => p.EndNodeID == endNodeId);
        }
        #endregion
    }
}
